#!/bin/bash

#remove the menu launcher
rm -f ~/.local/share/applications/mullvad.desktop

#before removing the mullvad-browser folder, move the browser configuration like bookmarks, etc
if [ -d ~/mullvad-browser ];then
  mkdir -p ~/mullvad-browser.temp/Browser/MullvadBrowser/Data
  mv -n ~/mullvad-browser/Browser/MullvadBrowser/Data/Browser ~/mullvad-browser.temp/Browser/MullvadBrowser/Data
fi

#remove all browser internals (except for user-data which we moved already)
rm -rf ~/mullvad-browser

#remove icon
rm -f ~/.local/share/icons/mullvad-browser.png

#move back the temporary folder containing user-data
if [ -d ~/mullvad-browser.temp ];then
  mv ~/mullvad-browser.temp ~/mullvad-browser

  #let the user know where configuration is
  echo "Mullvad Browser has been uninstalled, but user-data like settings and bookmarks remain intact.
To remove these files, run this command:
rm -rf ~/mullvad-browser"
  
fi
